/**
 * CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

package com.cmcc.zysoft.infocollection.mobile.service;

import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cmcc.zysoft.infocollection.mobile.dao.MInterfaceLogDao;
import com.cmcc.zysoft.infocollection.model.InterfaceLog;
import com.starit.common.dao.hibernate.HibernateBaseDao;
import com.starit.common.dao.service.BaseServiceImpl;

/**
 * @author 袁凤建
 * <br />邮箱: yuan.fengjian@ustcinfo.com
 * <br />描述: InterfaceLogService.java
 * <br />版本: 1.0.0
 * <br />日期: 2013-8-8 上午10:05:59
 * <br />CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

@Service
public class MInterfaceLogService extends BaseServiceImpl<InterfaceLog, Long> {

	@Resource
	private MInterfaceLogDao mInterfaceLogDao;
	
	@Override
	public HibernateBaseDao<InterfaceLog, Long> getHibernateBaseDao() {
		return this.mInterfaceLogDao;
	}
	
	/**
	 * 添加接口调用日志.
	 * @param userId 用户ID
	 * @param companyId 企业ID
	 * @param interfaceName 接口名称
	 */
	@Transactional
	public void addLog(String userId, String companyId, String interfaceName) {
		InterfaceLog interfaceLog = new InterfaceLog();
		interfaceLog.setCompanyId(companyId);
		interfaceLog.setInterfaceName(interfaceName);
		interfaceLog.setOperateMan(userId);
		interfaceLog.setOperateTime(new Date());
		this.mInterfaceLogDao.save(interfaceLog);
	}
}